<%--
  Created by IntelliJ IDEA.
  User: Administrator
  Date: 2017/12/2
  Time: 16:31
  To change this template use File | Settings | File Templates.
--%>
<%@ page contentType="text/html;charset=UTF-8" language="java" %>
<html>
<head>
    <base href="${pageContext.request.contextPath}/">
    <title>指派销售机会</title>
    <link href="css/style.css" rel="stylesheet" type="text/css">
    <script src="js/jquery-1.9.0.js"></script>
    <script src="script/common.js"></script>
</head>
<body>

<div class="page_title">销售机会管理&nbsp; &gt; 指派销售机会</div>
<div class="button_bar">
    <button class="common_button" onclick="help('');">帮助</button>
    <button class="common_button" onclick="back();">返回</button>
    <button class="common_button" id="save">保存</button>
</div>
<form action="salc/dispatchUpdate" method="post" id="formx">
<table class="query_form_table">
    <tr>
        <th>编号</th>
        <td>${salChance.chcId}
            <input type="hidden" value="${salChance.chcId}" name="chcId">
        </td>
        <th>机会来源</th>
        <td>${salChance.chcSource}</td>
    </tr>
    <tr>
        <th>客户名称</th>
        <td>${salChance.chcCustName}</td>
        <th>成功机率（%）</th>
        <td>&nbsp;${salChance.chcRate}</td>
    </tr>
    <tr>
        <th>概要</th>
        <td colspan="3">${salChance.chcTitle}</td>
    </tr>
    <tr>
        <th>联系人</th>
        <td>${salChance.chcLinkman}</td>
        <th>联系人电话</th>
        <td>${salChance.chcTel}</td>
    </tr>
    <tr>
        <th>机会描述</th>
        <td colspan="3">
            <textarea rows="5" cols="40" readonly>${salChance.chcDesc}</textarea>
        </td>
    </tr>
    <tr>
        <th>创建人</th>
        <td>${salChance.chcCreateBy}</td>
        <th>创建时间</th>
        <td id="chcCreateDate">${salChance.chcCreateDate}</td>

    </tr>
</table>
<br />
<table class="query_form_table" id="table1">
    <tr>
        <th>指派给</th>
        <td>
            <input type="hidden" name="chcDueTo" id="chcDueTo">
            <select name="chcDueId" id="chcDueId">

            </select> <span class="red_star">*</span></td>

            </td>
        <th>指派时间</th>
        <td>
            <input id="t2" name="chc_DueDate" type="date" required/><span class="red_star">*</span></td>
    </tr>
</table>
</form>
<script>
    $(function () {
        var time=$("#chcCreateDate");
        var newDate = new Date();
        var val=$.trim($(time).text());


        if(val == '0'){
            $(time).html("");
        }else {
            newDate.setTime(val);
            $(time).html(newDate.toLocaleDateString());
        }

        $.get("salc/userall", function (data) {
            console.log(data);
            var chcDueId = $("#chcDueId");
            var chcDueTo = $("#chcDueTo");
            $.each(data, function (i, item) {
                var option = '<option value=' + item.usrId + ' >' + item.usrName + '</option>';
                chcDueId.append($(option));
            });
            var option = $("#chcDueId option:selected");
            var usrName = $(option).text();
            chcDueTo.val(usrName);
        });

        $("#chcDueId").change(function () {
            var chcDueTo = $("#chcDueTo");
            var option = $("#chcDueId option:selected");
            var usrName = $(option).text();
            chcDueTo.val(usrName);
        })

        $("#save").click(function () {
            alert(1);
            $("#formx").submit();
        })

    });
</script>
<script>
    setCurTime('t2');
</script>
</body>
</html>
